<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}

    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/cardinfo.css"/>

    <style>
        .checkbox input[type="checkbox"], .checkbox input[type="radio"]{
            width: 18px;
            height: 18px;
            margin-top:1px;
        }
    </style>
</head>
<body id="body">
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <!--路径导航-->
        <ol class="breadcrumb mgl15 mgr15">
            <li>当前位置是&nbsp;:</li>
           
          
            <li><a href="{:url('cardus/cardinfo',['card_id'=>$card['card_id']])}">会员卡管理</a></li>

            <li class="active" style="color: #02b87f;">开卡信息</li>
        </ol>
        <!--创建会员卡主要内容-->
        <div class="card-content mgl15 mgr15 clearfix">
            <form class="form-horizontal" id="tjform" action="" method="post">
                <div class="panel panel-default">
                    <div class="panel-heading">必填字段</div>
                    <div class="panel-body">
                        <div class="form-horizontal ng-scope" data-label="通用字段">
                            <div class="form-group">
                                <label class="col-sm-2 control-label ng-binding">通用字段</label>
                                <div class="col-sm-10">
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_MOBILE" type="checkbox" class="checkphone" onclick="radio('checkphone')" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">手机号</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_NAME" type="checkbox" class="checkname" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">姓名</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_SEX" type="checkbox" class="checksex" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">性别</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" type="checkbox" value="USER_FORM_INFO_FLAG_BIRTHDAY" class="checkbirthday" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">生日</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_IDCARD" type="checkbox" class="checkidcard" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">身份证</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_EMAIL" type="checkbox" class="checkemail" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">邮箱</label>
                                     </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_LOCATION" type="checkbox" class="checkaddress" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">详细地址</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_EDUCATION_BACKGRO" type="checkbox" class="checkeducation" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">教育背景</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_INDUSTRY" type="checkbox" class="checkhangye" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">行业</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_INDUSTRY" type="checkbox" class="checkshouru" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">收入</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_btian[]" value="USER_FORM_INFO_FLAG_HABIT" type="checkbox" class="checklove" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">兴趣爱好</label>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="form-horizontal ng-scope" data-label="允许用户修改">
                            <div class="form-group"><label class="col-sm-2 control-label ng-binding">允许用户修改</label>
                                <div class="col-sm-10">
                                    <span class="radio ng-scope radio-inline" >
                                        <input name="b_can_modify" type="radio"  checked="checked" class="b_can_modify"  value="true">
                                        <label class="ng-binding">允许</label>
                                    </span>
                                    <span class="radio ng-scope radio-inline" >
                                        <input name="b_can_modify" type="radio" class="b_can_modify" value="false">
                                        <label class="ng-binding">不允许</label>
                                    </span>
                                    <div class="r-message ng-scope ng-inactive">
                                    </div>
                                    <div class="r-desc ng-binding ng-scope">用户开卡后是否允许修改必填字段信息,该设置作用于所有必填字段</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">选填字段</div>
                    <div class="panel-body">
                        <div class="form-horizontal ng-scope" data-label="通用字段">
                            <div class="form-group">
                                <label class="col-sm-2 control-label ng-binding">通用字段</label>
                                <!--<input type="hidden" name="optional_form[custom_field_list][]" value="实体卡号">-->
                                <div class="col-sm-10">
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_MOBILE " type="checkbox" class="checkphone" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">手机号</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_NAME" type="checkbox" class="checkname" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">姓名</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_SEX" type="checkbox" class="checksex" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">性别</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" type="checkbox" value="USER_FORM_INFO_FLAG_BIRTHDAY" class="checkbirthday" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">生日</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_IDCARD" type="checkbox" class="checkidcard" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">身份证</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_EMAIL" type="checkbox" class="checkemail" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">邮箱</label>
                                     </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_LOCATION" type="checkbox" class="checkaddress" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">详细地址</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_EDUCATION_BACKGRO" type="checkbox" class="checkeducation" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">教育背景</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_INDUSTRY" type="checkbox" class="checkhangye" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">行业</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_INCOME" type="checkbox" class="checkshouru" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">收入</label>
                                    </span>
                                    <span class="checkbox ng-scope checkbox-inline">
                                        <input name="is_xtian[]" value="USER_FORM_INFO_FLAG_HABIT" type="checkbox" class="checklove" onclick="radio(this.classList[0])">
                                        <label class="ng-binding">兴趣爱好</label>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="form-horizontal ng-scope" data-label="允许用户修改">
                            <div class="form-group"><label class="col-sm-2 control-label ng-binding">允许用户修改</label>
                                <div class="col-sm-10">
                                    <span class="radio ng-scope radio-inline" >
                                        <input name="x_can_modify" type="radio" checked="checked" class="x_can_modify"  value="true">
                                        <label class="ng-binding">允许</label>
                                    </span>
                                    <span class="radio ng-scope radio-inline" >
                                        <input name="x_can_modify" type="radio"  class="x_can_modify" value="false">
                                        <label class="ng-binding">不允许</label>
                                    </span>
                                    <div class="r-message ng-scope ng-inactive">
                                    </div>
                                    <div class="r-desc ng-binding ng-scope">用户开卡后是否允许修改必填字段信息,该设置作用于所有必填字段</div>
                                </div>
                            </div>
                        </div>
                        <div class="text-center">
                            <button class="btn btn-success" id="tj" type="button">提交</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>

        {include file='public/footer'/}
    </div>
</section>
<script>
    $(document).ready(function(){
        var data = eval("("+'{$activate}'+")");
        if(!data){
            return;
        }
        //        必填是否可修改
        var btxg = data.required_form.can_modify;
//        必填字段
        var btzd = data.required_form.common_field_id_list;
//        选填字段可修改
        var xtxg = data.optional_form.can_modify;
//        必填字段
        var xtzd = data.optional_form.common_field_id_list;
        if(btxg == true){
            $(".b_can_modify").eq(0).attr("checked",true);
            $(".b_can_modify").eq(1).removeAttr("checked");
        }else{
            $(".b_can_modify").eq(1).attr("checked",true);
            $(".b_can_modify").eq(0).removeAttr("checked");
        }
        if(btzd){
            for(var i=0;i<$("input[name='is_btian[]']").length;i++){
                for(var j=0;j<btzd.length;j++){
                    if($("input[name='is_btian[]']").eq(i).val()==btzd[j]){
                        $("input[name='is_btian[]']").eq(i).attr("checked","checked");
                        $("input[name='is_xtian[]']").eq(i).parent().addClass("hide");
                    }
                }
            }
        }
        if(xtxg == true){
            $(".x_can_modify").eq(1).removeAttr("checked");
            $(".x_can_modify").eq(0).attr("checked","checked");
        }else{
            $(".x_can_modify").eq(0).removeAttr("checked");
            $(".x_can_modify").eq(1).attr("checked","checked");
        }
        if(xtzd) {
            for (var i = 0; i < $("input[name='is_xtian[]']").length; i++) {
                for (var j = 0; j < xtzd.length; j++) {
                    if ($("input[name='is_xtian[]']").eq(i).val() == xtzd[j]) {
                        $("input[name='is_xtian[]']").eq(i).attr("checked", "checked");
                        $("input[name='is_btian[]']").eq(i).parent().addClass("hide");
                    }
                }
            }
        }
    })
    function radio(type){
        var len = $("."+type).length;
        for(var i=0;i<len;i++){
            $("."+type).parent().addClass("hide");
            if($("."+type).eq(i).is(":checked")){
                $("."+type).eq(i).parent().removeClass("hide");
                return false;
            }else{
                $("."+type).parent().removeClass("hide");
            }
        }
    }
    $(function(){
        $("#tj").click(function(){
            var checkbox = $("input[type='checkbox']");
            var len = $("input[type='checkbox']").length;
            var checklen=0;
            for(var i=0;i<len;i++){
                if(checkbox.eq(i).is(":checked")){
                    checklen++;
                }
            }
            if(checklen==0){
                layer.alert("请选择必填字段或选填字段",{icon:7});
                return false
            }else if(checklen>5){
                layer.alert("必填字段和选填字段最多选择五个",{icon:7});
                return false
            }else{
                $("#tjform").submit();
            }
        })
    })
</script>
</body>

</html>
